﻿<Window x:Class="Mantin.Controls.Wpf.Notification.Balloon"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Height="90" Width="250" WindowStyle="None" 
        ResizeMode="NoResize" ShowInTaskbar="False"
        Topmost="True" IsTabStop="False" 
        OverridesDefaultStyle="False" 
        SizeToContent="Height"
        AllowsTransparency="True" 
        Background="Transparent" >
    <Grid RenderTransformOrigin="0,1" >        
        <StackPanel Orientation="Vertical">
            <StackPanel Orientation="Horizontal">
                <StackPanel.Resources>
                    <Style TargetType="Path">
                        <Setter Property="Fill" Value="#fdfdfd"/>
                        <Setter Property="Stretch" Value="Fill"/>
                        <Setter Property="Width" Value="22"/>
                        <Setter Property="Height" Value="31"/>
                        <Setter Property="Panel.ZIndex" Value="99"/>
                        <Setter Property="VerticalAlignment" Value="Top"/>
                        <Setter Property="Effect">
                            <Setter.Value>
                                <DropShadowEffect Color="#FF757575" Opacity=".7"/>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </StackPanel.Resources>
                <Path  
                  HorizontalAlignment="Left"  
                  Margin="15,3,0,0" 
                    Data="M10402.99154,55.5381L10.9919,0.64 0.7,54.9"
                  x:Name="PathPointLeft"/>
                <Path  
                    HorizontalAlignment="Right"  
                    Margin="175,3,0,0"
                    Data="M10402.992,55.5381 L10284.783,3.2963597 0.7,54.9"
                    x:Name="PathPointRight">
                </Path>
            </StackPanel>
            
            <Border Margin="5,-3,5,5" 
                    CornerRadius="7" Panel.ZIndex="100"
                    VerticalAlignment="Top">
                <Border.Background>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                        <LinearGradientBrush.RelativeTransform>
                            <RotateTransform Angle="90" CenterX="0.7" CenterY="0.7" />
                        </LinearGradientBrush.RelativeTransform>
                        <GradientStop Color="#FFFDFDFD" Offset=".2"/>
                        <GradientStop Color="#FFB6FB88" Offset=".8"/>
                    </LinearGradientBrush>
                </Border.Background>
                <Border.Effect>
                    <DropShadowEffect Color="#FF757575" Opacity=".7"/>
                </Border.Effect>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <Image Grid.Column="0" 
                           Width="35" 
                           Margin="5"
                           VerticalAlignment="Top" Height="35" 
                           Source="Resources/help.png" />

                    <TextBlock Grid.Column="1" 
                               TextWrapping="Wrap"
                               Margin="0,10,10,10" 
                               TextOptions.TextFormattingMode="Display"
                               x:Name="textBlockCaption"
                               Text="This is the caption"/>
                </Grid>
            </Border>
        </StackPanel>

        <!-- Animation -->
        <Grid.Triggers>
            <EventTrigger RoutedEvent="FrameworkElement.Loaded">
                <BeginStoryboard x:Name="StoryboardLoad">
                    <Storyboard>
                        <DoubleAnimation Storyboard.TargetProperty="(UIElement.Opacity)" From="0.0" To="1.0" Duration="0:0:2" />
                        <DoubleAnimation Storyboard.TargetProperty="(UIElement.Opacity)" From="1.0" To="0.0" Duration="0:0:3" BeginTime="0:0:3" Completed="DoubleAnimationCompleted"/>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>

            <EventTrigger RoutedEvent="Mouse.MouseEnter">
                <EventTrigger.Actions>
                    <RemoveStoryboard BeginStoryboardName="StoryboardLoad"/>
                    <RemoveStoryboard BeginStoryboardName="StoryboardFade"/>
                </EventTrigger.Actions>
            </EventTrigger>

            <EventTrigger RoutedEvent="Mouse.MouseLeave">
                <BeginStoryboard x:Name="StoryboardFade">
                    <Storyboard>
                        <DoubleAnimation Storyboard.TargetProperty="(UIElement.Opacity)" From="1.0" To="0.0" Duration="0:0:1" BeginTime="0:0:1" Completed="DoubleAnimationCompleted"/>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </Grid.Triggers>

        <Grid.RenderTransform>
            <ScaleTransform ScaleY="1" />
        </Grid.RenderTransform>
    </Grid>
</Window>